package de.fmannan.addbook.views;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;

import de.fmannan.addbook.MyImageRegistry;
import de.fmannan.addbook.domainmodel.Contact;

/**
 * @author fmannan
 * 
 * Don't really know what this class does .... supposed to provide labels ?
 * 
 */
class TreeViewLabelProvider extends LabelProvider {

	private final ContactTreeView contactTreeView;

	TreeViewLabelProvider(ContactTreeView contactTreeView) {
		this.contactTreeView = contactTreeView;
	}
	
	public String getText(Object obj) {
		return obj.toString();
	}
	
	/**
	 * Determines which icons are used for parent-tree-objects and which icons
	 * are used for child-tree-objects.
	 */
	public Image getImage(Object obj) {
		String imageKey = MyImageRegistry.GROUP_ICON;
		if (obj instanceof Contact)
		   imageKey = MyImageRegistry.CONTACT_ICON;
		return MyImageRegistry.getImageRegistry().get(imageKey);
	}
}